if (!TrvnInterceptorService) {

	var TrvnInterceptorService = {
		interceptorArray : [],
		interceptorMap : {},
		installInterceptor : function(interceptor) {
			try {
				if (!interceptor || !interceptor.intercept || (typeof interceptor.intercept) != "function") {
					TrvnUtils.Logger.warn("invalid interceptor[" + interceptor.name + "].");
				}
				if (this.interceptorMap[interceptor.name]) {
					TrvnUtils.Logger.warn("interceptor[" + interceptor.name + "] already exist.");
				} else {
					this.interceptorMap[interceptor.name] = interceptor;
					this.interceptorArray.push(interceptor);
				}
			} catch (e) {
				TrvnUtils.Logger.error("interceptor-service.js 401: " + e);
			}
		},
		intercept : function(param) {
			for (var i = 0;i < this.interceptorArray.length; i++) {
				try {
					if (this.interceptorArray[i].isAvailble()) this.interceptorArray[i].intercept(param);
				} catch (e) {
					TrvnUtils.Logger.error(this.interceptorArray[i].name + ": " + e);
				}
			}
		},
		interceptByNames : function(param, names, without) {
			names.each(function(name) {
				try {
					if (this.interceptorMap[name]) {
						this.interceptorMap[name].intercept(param);
					} else {
						TrvnUtils.Logger.warn("interceptor[" + name + "] not exist.");
					}
				} catch (e) {
					TrvnUtils.Logger.error(this.interceptorArray[i].name + ": " + e);
				}
			});
		}
	};

}